package dk.itu.spvc.bluefriends;


import android.app.TabActivity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;
import android.widget.TextView;

public class TabContainer extends TabActivity{
	/** Called when the activity is first created. */
	TabHost mTabHost;
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.tabhost);
		mTabHost = (TabHost)findViewById(android.R.id.tabhost);
		setupTab(new TextView(this), "Tweet",TweetActivity.class);
		setupTab(new TextView(this), "Friend",FriendActivity.class);
		setupTab(new TextView(this), "Request",RequestActivity.class);
	 }
    
    private void setupTab(final View textView,final String tag, Class class1) {
		View tabview = createTabView(mTabHost.getContext(), tag);
		TabSpec setContent = mTabHost.newTabSpec(tag).setIndicator(tabview).setContent(new Intent(this,class1));
		//setContent.setContent(new Intent(this,class1));
		mTabHost.addTab(setContent);	
	}
	
	private static View createTabView(final Context context, final String text) {
		View view = LayoutInflater.from(context).inflate(R.layout.tabs_bg, null);
		TextView tv = (TextView)view.findViewById(R.id.tabsText);
		tv.setText(text);
		return view;
	}

}
